home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Found / FWExcLib / Include / FWPostEx.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-08  |  2.0 KB  |  79 lines  |  [TEXT/MPS ]

  1. #ifndef FWPOSTEX_H
  2. #define FWPOSTEX_H
  3. //========================================================================================
  4. //
  5. //    File:                FWPostEx.h
  6. //    Release Version:    $ 1.0d11 $
  7. //
  8. //    Copyright:    (c) 1993, 1995 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef   FWEXCEPT_H
  13. #include "FWExcept.h"
  14. #endif
  15.  
  16. #ifndef   FWSPOSTE_H
  17. #include "FWSPostE.h"
  18. #endif
  19.  
  20. #if FW_LIB_EXPORT_PRAGMAS
  21. #pragma lib_export on
  22. #endif
  23.  
  24. //========================================================================================
  25. // CLASS FW_CPostedException
  26. //========================================================================================
  27.  
  28. class FW_CLASS_ATTR FW_CPostedException
  29. {
  30.  
  31. public:
  32.  
  33.     static void Initialize(FW_SPrivPostedExceptionGlobals& globals);
  34.         // Initialize.  Should only be called once, before any exception is posted.
  35.         // Exception buffer is allocated as maxExceptionSize bytes.
  36.         
  37.     static void Terminate();
  38.         // Cleanup.  Releases exception buffer.
  39.  
  40.     static void PostException(const _FW_XException& exception);
  41.         // Post an exception.
  42.         // No-op if posted exception already pending.
  43.     
  44.     static short IsPendingException();
  45.         // Returns 1 if an exception has been posted and not yet thrown.
  46.         // Returns 0 otherwise.
  47.     
  48.     static void ThrowPostedException();
  49.         // Throw the posted exception.
  50.         // It is a no-op to invoke this function if no exception is pending.
  51.  
  52.     static FW_SPrivPostedExceptionGlobals&    GetPostedExceptionGlobals();
  53.  
  54. private:
  55.  
  56.     enum
  57.     {
  58.         kPostedExceptionGlobals = 116
  59.     };
  60.  
  61. private:
  62.     static FW_SPrivPostedExceptionGlobals gGlobals;    
  63. };
  64.  
  65. //========================================================================================
  66. // FW_CPostedException inline functions
  67. //========================================================================================
  68.  
  69. inline short FW_CPostedException::IsPendingException()
  70. {
  71.     return GetPostedExceptionGlobals().gPending;
  72. }
  73.  
  74. #if FW_LIB_EXPORT_PRAGMAS
  75. #pragma lib_export off
  76. #endif
  77.  
  78. #endif
  79.